< previous page page_613 next page >

Page 613
In the References dialog box of Visual Basic, two entries are used with ADO: Microsoft ActiveX Data Objects 2.0 Library and Microsoft ActiveX Data Objects Recordset 2.0 Library. To use the ADO object examples in this chapter, make sure that you include the appropriate references, as pictured in Figure 28.1.
0613-01.jpg
Figure 28.1
Choose Project References to add
references for ADO to your program.
The reference titled Microsoft ActiveX Data Objects 2.0 Library contains the full-featured ADO objects discussed throughout most of this chapter. The other reference contains only the Recordset object, intended for use with remote disconnected recordsets.
Setting Up a Data Source
When you use data in your program, that data has to come from a data source. A data source is a database that can be anything from a small Microsoft Access database to an IBM AS/400. Many different types of database products are available, and you can connect to almost all of them. Open Database Connectivity, or ODBC, is one vehicle that allows you to connect to a variety of data sources. You set up the ODBC database driver in Windows and then use it to access the database from Visual Basic.
To use the examples in this chapter, you have to create a data source for the database BIBLIO.MDB, which is included with Visual Basic. Start by clicking the icon labeled 32-bit ODBC in the Windows Control Panel. You then see the ODBC Data Source Administrator, as shown in Figure 28.2.
note.gif You also can create DSN-less connections. See the section "Making the Connection with ADO" later in this chapter. square.gif

To create a new data source, first click the Add button. BIBLIO.MDB is an Access database, so select Microsoft Access Driver and click Finish. A dialog box for the Access ODBC driver then appears. Click the Select button, and locate BIBLIO.MDB (usually in the Visual Basic application directory). Name the data source BIBLIO, and enter a description if you want. The completed configuration screen should look similar to Figure 28.3.

 
< previous page page_613 next page >